home *** CD-ROM | disk | FTP | other *** search
- unit StrFake;
-
- {small unit to allow to set the capacity in a TStringList object}
-
- interface uses Classes;
-
- {- exposed routine : set capacity in a string list -}
- procedure SetStringListCapacity(SL: TStringList; Size: integer);
-
- implementation
-
- type TStringListFake = class(TStrings)
- public
- FList: PStringItemList;
- FCount: Integer;
- FCapacity: Integer;
- procedure SetCapacity(NewCapacity: Integer);
- end;
-
- procedure TStringListFake.SetCapacity(NewCapacity: Integer);
- begin
- ReallocMem(FList, NewCapacity * SizeOf(TStringItem));
- FCapacity := NewCapacity;
- end;
-
- procedure SetStringListCapacity(SL: TStringList; Size: integer);
- {$IFNDEF VER90}
- !! 'check class "TStringListFake" with other version than Delphi 2'
- {$ENDIF}
- var XL : TStringListFake absolute SL;
- begin
- XL.SetCapacity(Size);
- end;
-
- end.
-